function setCookie(key = '', value = '', time = 5) {
	if (typeof value === 'object') {
		value = JSON.stringify(value)
	}
	const d = new Date()
	d.setTime(d.getTime() - 1000 * 60 ** 2 * 8 + 1000 * time)
	document.cookie = `${key}=${value}; expires=${d}`
}

function getCookie(queryKey) {
	let tmpArr = document.cookie.split('; ')
	for (let msg of tmpArr) {
		let [key, value] = msg.split("=")
		if (queryKey === key) return value
	}
}

function removeCookie(key) {
	setCookie(key, null, -1)
}